import dayjs from "dayjs";
export const getDayJS = (time: any = "", type: string = "YYYY-MM-DD") => {
    if (!time) return ""
    return dayjs(time).format(type)
}

export const getTimeTypeDayJS = (time: any = "", type: string = "YYYY-MM-DD HH:mm:ss", timeType: string = 'YYYY MMMM DD HH:mm') => {
    if (!time) return ""
    return dayjs(time, timeType).format(type)
}

export const getWeekday = (time: any = "") => {
    if (!time) return ""
    let week = dayjs(time).day()
    return week
}

export const getDateDay = (time: any = "") => {
    if (!time) return ""
    let date = dayjs(time).date()
    return date
}

export const getDayNum = (type:any = 19) => {
    var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
    var time = nowDate.toJSON().split('T').join(' ').substr(0, type);
    return time
}